﻿using DotNetMVC.OA.BLL;
using DotNetMVC.OA.IBLL;
using DotNetMVC.OA.Model;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DotNetMVC.OA.Test.Controllers
{
    public class UserInfoController : Controller
    {
        //IUserInfoService userInfoService = new UserInfoService();

        public IUserInfoService UserInfoService { get; set; }


        // GET: UserInfo
        public ActionResult Index()
        {

            ILog logWriete = log4net.LogManager.GetLogger("Demo");
            logWriete.Error("log4net Error 错误");


            IEnumerable<UserInfo> list = UserInfoService.GetEntities(u => true).ToList();
            return View(list);
        }
        [HttpGet]
        public ActionResult Create()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Create(UserInfo userInfo)
        {
            UserInfoService.Add(userInfo);
            return Redirect("Index");
        }
    }
}